package com.zzr.zzrbackend.mapper;

import com.zzr.zzrbackend.pojo.domain.User;
import com.zzr.zzrbackend.pojo.dto.param.LoginParam;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface UserMapper {

    User selectById(Integer userId);

    /**
     * 插入user
     *
     * @param record
     * @return
     */
    int insertSelective(User record);

    /**
     * 插入user
     *
     * @param record
     * @return
     */
    int insert(User record);

    Integer updateByCertification(Integer userId);

    Integer updateByIdentity(Integer isSetIdentity, Integer userId);

    /**
     * 检验账号密码是否正确，返回user
     *
     * @param record
     * @return
     */
    User selectByUserNameAndPassword(LoginParam record);

    /**
     * 检验studentId是否存在，返回user
     *
     * @param record
     * @return
     */
    User selectByUserName(String record);

    User selectByPermission(Integer record);

    Integer updatePermissionByUserId(Integer permission, Integer userId);

    Integer selectIdByUserName(String userName);

    Integer selectPermissionByUserId(Integer userId);

    String selectUserNameById(Integer id);

    List<User> selectByPhone(String phone);

    List<User> selectAllUser();

    Integer updatePassword(String userName, String password);

    Integer updateEvaluation(Integer userId);

    Integer updatePhone(Integer userId, String phone);

    Integer updateUserName(Integer userId, String name);
}

